function plotMesh(mesh,param)
nn = mesh.countNodes();
nf = mesh.countFaces();
if cellfind(param,'trimesh')
    tri = [];
    for i=1:nf
        f = mesh.getFace(i-1);
        N = f.getNodes();
        for j=1:N.length()
            tri(i,j) = N(j).getId();
        end
    end
    for i=1:nn
        ncor = mesh.getNode(i-1).getPosition();
        X(i) = ncor(1);
        Y(i) = ncor(2);
    end
    figure
    trimesh(tri,X,Y,'color','blue');
    axis equal
elseif cellfind(param,'normal')
    %% prepare adjacent matrix
    adj = getAdjacentMatrix(mesh);
    %% plot the mesh
    figure
    axis equal
    for i=1:nn
        X1 = mesh.getNode(i-1).getPosition();
        for j=1:nn
            X2 = mesh.getNode(j-1).getPosition();
            if (adj(i,j)==1 || adj(j,i)==1) && i~=j
                line([X1(1) X2(1)],[X1(2) X2(2)]);
            end
        end
    end
else
    disp('choose an option to plot mesh: trimesh/normal');
end
if cellfind(param,'conditions')
    %% plot conditions
    hold on
    for i=1:nn
        plotCondition(mesh.getNode(i-1));
    end
end
if cellfind(param,'id')
    %% plot node ids
    hold on
    for i=1:nn
        node = mesh.getNode(i-1);
        id = node.getId();
        X = node.getPosition();
        text(X(1),X(2),num2str(id),'color','magenta');
    end
    %% plot face ids
    hold on
    for i=1:nf
        face = mesh.getFace(i-1);
        id = face.getId();
        N = face.getNodes();
        cx = 0;
        cy = 0;
        for j=1:N.length()
            X = N(j).getPosition();
            cx = cx + X(1);
            cy = cy + X(2);
        end
        cx = cx/N.length();
        cy = cy/N.length();
        text(cx,cy,num2str(id),'color','cyan');
    end
end

end
